<template>
  <view class="page">
    <view :style="{ height: statusBarHeight + 'px' }"></view>
    <view class="nav-bar"
      ><view class="nav-left" @tap="goBack"><text class="fa fa-arrow-left"></text></view
      ><view class="nav-title">基本信息</view
      ><text class="nav-save" @tap="saveInfo">保存</text></view
    >
    <scroll-view scroll-y class="content">
      <view class="form-list">
        <view class="form-item" @tap="selectAvatar"
          ><text class="form-label">头像</text
          ><view class="form-value"
            ><image
              class="avatar"
              src="https://images.unsplash.com/photo-1544005313-94ddf0286df2?q=80&w=600&auto=format&fit=crop"
              mode="aspectFill"
            /><text class="arrow">›</text></view
          ></view
        >
        <view class="form-item"
          ><text class="form-label">姓名</text
          ><view class="form-value"
            ><input class="form-input" type="text" value="张伟" /><text
              class="arrow"
              >›</text
            ></view
          ></view
        >
        <view class="form-item" @tap="selectGender"
          ><text class="form-label">性别</text
          ><view class="form-value"
            ><text class="form-text">男</text><text class="arrow">›</text></view
          ></view
        >
        <view class="form-item" @tap="selectDate"
          ><text class="form-label">出生日期</text
          ><view class="form-value"
            ><text class="form-text">1985-03-15</text
            ><text class="arrow">›</text></view
          ></view
        >
        <view class="form-item"
          ><text class="form-label">手机号码</text
          ><view class="form-value"
            ><input class="form-input" type="tel" value="138****8888" /><text
              class="arrow"
              >›</text
            ></view
          ></view
        >
        <view class="form-item"
          ><text class="form-label">邮箱</text
          ><view class="form-value"
            ><input
              class="form-input"
              type="email"
              value="zhangwei@hospital.com"
            /><text class="arrow">›</text></view
          ></view
        >
        <view class="form-item" @tap="selectHospital"
          ><text class="form-label">医院</text
          ><view class="form-value"
            ><text class="form-text">第一人民医院</text
            ><text class="arrow">›</text></view
          ></view
        >
        <view class="form-item" @tap="selectRole"
          ><text class="form-label">角色</text
          ><view class="form-value"
            ><text class="form-text">医生</text
            ><text class="arrow">›</text></view
          ></view
        >
        <view class="form-item" @tap="selectDept"
          ><text class="form-label">科室</text
          ><view class="form-value"
            ><text class="form-text">ICU</text
            ><text class="arrow">›</text></view
          ></view
        >
        <view class="form-item" @tap="selectPosition"
          ><text class="form-label">职位</text
          ><view class="form-value"
            ><text class="form-text">主治医师</text
            ><text class="arrow">›</text></view
          ></view
        >
        <view class="form-item" @tap="selectEducation"
          ><text class="form-label">学历</text
          ><view class="form-value"
            ><text class="form-text">硕士研究生</text
            ><text class="arrow">›</text></view
          ></view
        >
      </view>
    </scroll-view>
  </view>
</template>
<script>
export default {
  data() {
    return { statusBarHeight: 0 };
  },
  onLoad() {
    this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight || 0;
  },
  methods: {
    goBack() {
      uni.navigateBack();
    },
    saveInfo() {
      uni.showToast({ title: "保存成功", icon: "success" });
    },
    selectAvatar() {
      uni.showToast({ title: "选择头像", icon: "none" });
    },
    selectGender() {},
    selectDate() {},
    selectHospital() {},
    selectRole() {},
    selectDept() {},
    selectPosition() {},
    selectEducation() {},
    goToHome() {
      uni.navigateTo({ url: "/pages/home/home" });
    },
  },
};
</script>
<style scoped>
.page {
  min-height: 100vh;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
}
.nav-bar {
  height: 44px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.nav-left {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}
.nav-title {
  font-size: 17px;
  font-weight: 600;
}
.nav-save {
  position: absolute;
  right: 16px;
  font-size: 14px;
  color: #2563eb;
}
.icon {
  font-size: 20px;
}
.content {
  flex: 1;
  padding: 16px 16px 70px;
  box-sizing: border-box;
}
.form-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.form-item {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.form-label {
  font-size: 14px;
  font-weight: 500;
  color: #111;
}
.form-value {
  display: flex;
  align-items: center;
  gap: 8px;
}
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 24px;
}
.form-input {
  text-align: right;
  font-size: 14px;
  color: #4b5563;
  background: transparent;
}
.form-text {
  font-size: 14px;
  color: #4b5563;
}
.arrow {
  font-size: 16px;
  color: #9ca3af;
}
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: #fff;
  border-top: 1px solid #f3f4f6;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.tabbar-icon {
  font-size: 22px;
}
.tabbar-text {
  font-size: 12px;
  color: #6b7280;
}
.tabbar-text-active {
  color: #2563eb;
  font-weight: 500;
}
</style>

